<template>
    <div class="root-container">
        <el-menu theme="dark" :default-active="activeIndex" class="el-menu-demo" mode="horizontal" :router="true">
            <el-menu-item index="/">
                {{i18nTexts.ui.settings.tabs.general}}
            </el-menu-item>
            <el-menu-item index="/plugins">
                {{i18nTexts.ui.settings.tabs.plugins}}
            </el-menu-item>
            <el-menu-item index="/workflows">
                {{i18nTexts.ui.settings.tabs.workflows}}
            </el-menu-item>
            <el-menu-item index="/websites">
                {{i18nTexts.ui.settings.tabs.websites}}
            </el-menu-item>
            <el-menu-item index="/newtabcomponents">
                {{i18nTexts.ui.settings.tabs.newtabcomponents}}
            </el-menu-item>
            <el-menu-item index="/wallpapers">
                {{i18nTexts.ui.settings.tabs.wallpapers}}
            </el-menu-item>
            <el-menu-item index="/appearance">
                {{i18nTexts.ui.settings.tabs.appearance}}
            </el-menu-item>
            <el-menu-item index="/advanced">
                {{i18nTexts.ui.settings.tabs.advanced}}
            </el-menu-item>
            <el-menu-item index="/help">
                {{i18nTexts.ui.settings.tabs.help}}
            </el-menu-item>
            <el-menu-item index="/update">
                {{i18nTexts.ui.settings.tabs.update}}
            </el-menu-item>
        </el-menu>
        <div class="page-container">
            <router-view :config="config" :i18nTexts="i18nTexts"/>
        </div>
    </div>    
</template>

<script>
const extType = EXT_TYPE === 'stewardplus' ? 'Steward Plus' : 'steward';
const storeId = extType === 'steward' ? 'dnkhdiodfglfckibnfcjbgddcgjgkacd' : 'jglmompgeddkbcdamdknmebaimldkkbl';

export default {
    name: 'app',
    props: ['config', 'i18nTexts', 'tabName'],
    data: function() {
        return {
            activeIndex: this.$route.path,
            extType,
            storeId,
        }
    },
    methods: {
    }
}
</script>

<style lang="scss">
@import '../../scss/main.scss';
@import '../../scss/themes/popup/classical.scss';

[v-cloak] {
    display: none;
}

body,
p,
div,
ul,
li {
    margin: 0;
    padding: 0;
}

img {
    vertical-align: top;
}

a {
    text-decoration: none;
}

body {
  box-sizing: border-box!important;
}
.json-editor {
  width: 400px;
  .je-object__title, .je-object__controls, .card-title {
    display: none!important;
  }

  &.data-editor {
      width: 100%;

      .je-object__container {
          margin-bottom: 10px;
      }
  }
}

.h1, .h2, .h3, .h4, .h5, .h6, h1, h2, h3, h4, h5, h6 {
  font-size: initial!important;
}

.topbar {
    width: 1200px;
    height: 40px;
    margin: 0 auto;
    overflow: hidden;

    .links {
        display: flex;
        height: 40px;
        align-items: center;
        float: right;

        a {
            display: block;
            margin: 0 10px;
            width: 30px;
            height: 30px;
        }

        img {
            width: 100%;
            height: 100%;
        }
    }
}

.steward {
    margin: 0 auto;

    .el-tab-pane {
        padding: 15px;
    }

    .main {
        box-sizing: border-box;
        margin: 0;
    
        * {
            box-sizing: inherit;
        }
    }

    .el-tabs__header,
    .el-collapse-item__header,
    .plugin-item,
    .el-form-item__label,
    .appearance-item {
        user-select: none;
    }
}

.steward .el-tabs__header {
    margin-bottom: 0;
}

.page-container {
    padding-left: 15px;
}

.general-panel {
    .el-form-item {
        margin-bottom: 5px;
    }
}

.shortcuts-config {
    .el-input {
        width: 100px;
    }
}

.plugin-searchbar,
.button-bar {
    padding: 10px;
}

.plugin-list,
.plugin-editor {
    height: calc(100vh - 57px);
    overflow-y: auto;
}

.bg-black {
    background: #f1f2f5;
}

.plugin-item {
    cursor: pointer;
    padding: 3px 8px;
    height: 40px;
    display: flex;
    align-items: center;
    position: relative;

    &.plugin-disabled {
        color: #999;
    }

    &.is-selected {
        color: #20a0ff;
    }
}

.workflow-item {
    display: flex;
    align-items: center;
}

.plugin-icon {
    width: 20px;
    height: 20px;
    float: left;
}

.plugin-name {
    margin-left: 5px;
    font-size: 14px;
    line-height: 1.4;
    font-weight: 100;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;

    &:hover {
        color: #20a0ff;
    }
}

.plugin-doc {
    margin-left: 12px;
    color: #20a0ff;

    &:hover {
        text-decoration: underline;
    }
}

.plugin-editor-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* editor */
.plugin-editor-header {
    display: flex;
    background: #333;
    height: 57px;
    padding: 12px;
}

.plugin-editor-config {
    flex: 1;
    background: #f1f2f5;
}

.plugin-editor-icon {
    width: 40px;
    height: 40px;
}

.plugin-editor-text {
    flex: 1;
    margin-left: 10px;
}

.plugin-editor-name {
    font-size: 14px;
    color: #fff;
    margin: 0;
}

.plugin-editor-title {
    font-size: 12px;
    color: #999;
}

.icon-batch {
    width: 17px;
    vertical-align: -3px;
}

.icon-newversion {
    width: 17px;
}

.changelog {
    padding: 5px 12px;
    height: 400px;
    border: 1px solid #ededed;
    overflow: scroll;
}

.text-panel {
    width: 740px;
    margin: 20px auto 0;
    color: rgba(51, 51, 51, 0.87);
    font-size: 16px;
    line-height: 1.6;
    border: 1px solid #ededed;
    padding: 15px 30px 25px;
}

.text-panel a {
    border-bottom: 1px solid #20a0ff;
    color: #20a0ff;
}

.text-panel .notice,
.text-panel em {
    color: #ff3f80;
    font-style: normal;
}

.text-panel .qrcode {
    box-shadow: 0 0 10px #555;
    border-radius: 6px;
    margin-left: auto;
    margin-right: auto;
    margin-top: 10px;
    margin-bottom: 10px;
    width: 200px;
}

.text-panel .qrcodes {
    display: flex;
    justify-content: space-between;
}

.wallpaper-box {
    position: relative;
    width: 25%;
    padding: 5px;
    float: left;
    box-sizing: border-box;
}

.wallpaper-add-btn {
    display: flex;
    justify-content: center;
    align-items: center;
    background: #f5f5f5;
    height: 135px;
    cursor: pointer;

    img {
        display: block;
        width: 50px;
        height: 50px;
    }
}

.wallpaper-box .wallpaper-img {
    display: block;
    position: relative;
    width: 100%;
    height: 135px;
    transition: transform .3s ease-out;
}

.wallpaper-box .selected-icon {
    width: 25px;
    height: 25px;
    position: absolute;
    right: 10px;
    bottom: 10px;
}

.wallpaper-box img:hover {
    transform: scale(1.1);
    z-index: 100;
}

.wallpaper-box .icon {
    display: none;
    position: absolute;
    width: 25px;
    height: 25px;
}

.wallpaper-box:hover .icon {
    display: block;
}

.wallpaper-box:hover .icon img {
    width: 100%;
    height: 100%;
    display: block;
}

.wallpaper-box .delete-wp {
    top: 10px;
    right: 10px;
    z-index: 101;
}

.wallpaper-box .download-wp {
    top: 45%;
    left: 45%;
}

.paths-container {
    .el-row {
        margin-top: 6px;
    }
}

.split {
    margin: 15px 0;
    border-bottom: 1px dotted #d1dbe5;
}

.network-icon {
    display: block;
    width: 25px;
    height: 25px;
}

.editor {
    margin-top: 10px;
    border: 1px solid #DCDFE6;
}
</style>
